package org.crmsystem.service.impl;

import java.util.ArrayList;
import java.util.HashMap;

import org.crmsystem.dao.IOrgMapper;
import org.crmsystem.model.OrgInfo;
import org.crmsystem.service.IOrgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * service实现类
 * @author 郑皓
 *
 */
@Service
public class OrgServiceImpl implements IOrgService{
	@Autowired
	private IOrgMapper iOrgMapper;
	
	/**
	 * 添加机构
	 */
	public int addOrg(OrgInfo orgInfo) {
		return iOrgMapper.addOrg(orgInfo);
	}
	/**
	 * 删除机构
	 */
	@Override
	public int delOrg(int orgId) {
		return iOrgMapper.delOrg(orgId);
	}
	/**
	 * 更新机构
	 */
	@Override
	public int updateOrg(OrgInfo orgInfo) {
		return iOrgMapper.updateOrg(orgInfo);
	}
	/**
	 * 模糊查询机构
	 * @return
	 */
	public ArrayList<OrgInfo> selectOrgList(HashMap<String,Object> searchMap){
		return iOrgMapper.selectOrgList(searchMap);
	}
	/**
	 * 根据机构id查询机构对象
	 */
	@Override
	public OrgInfo getOrgById(int id) {
		return iOrgMapper.getOrgById(id);
	}
	/**
	 * 根据name查询id
	 */
	public Integer getIdByName(String name) {
		return iOrgMapper.getIdByName(name);
	}
	@Override
	public int getOrgCount(HashMap<String, Object> searchMap) {
		return iOrgMapper.getOrgCount(searchMap);
	}
	
}
